﻿<Window x:Class="NetworkPower.UI.DefineDevice"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:NetworkPower.UI" 
        Title="定义设备" Height="568" Width="912" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
    <Window.Resources>
        <local:TerminalValueConvert x:Key="tnColorCvrt"/>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="39*"/>
            <RowDefinition Height="51*"/>
            <RowDefinition Height="58*"/>
            <RowDefinition Height="391*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="53*"/>
            <ColumnDefinition Width="49*"/>
            <ColumnDefinition Width="219*"/>
        </Grid.ColumnDefinitions>
        <Label Name="lbVoltage" Grid.Row="1" Grid.Column="0">电压等级</Label>
        <ComboBox Name="cbVoltage" Grid.Row="1" Grid.Column="0" Margin="10,25,10,1" SelectionChanged="cbVoltage_SelectionChanged"/>

        <Label Name="lbSeperatorType" Grid.Row="1" Grid.Column="1">间隔类型</Label>
        <ComboBox Name="cbSeperatorType" Grid.Row="1" Margin="6,25,0,2" Grid.Column="1" SelectionChanged="cbSeperatorType_SelectionChanged"/>

        <Label Grid.Row="2" Grid.Column="0" Margin="0,8,0,22">安装单位与间隔名称</Label>

        <Label Name="lbDevice" Grid.Row="3" Grid.Column="0" Margin="0,112,26,237">设备屏柜</Label>
        <ComboBox Name="cbCabinet" Grid.Row="3" Grid.Column="0" Margin="10,138,10,222" SelectionChanged="cbCabinet_SelectionChanged"/>


        <Label Name="lblDisplay" Grid.Row="1" Grid.Column="2" Margin="12,0,472,26">设备屏柜所含端子排</Label>
        <ListBox Name="lsTerminalNos" Grid.Row="1" Grid.Column="2" Grid.RowSpan="3" Margin="10,25,472,323" SelectionMode="Multiple"></ListBox>
        <Label Content="工程名称" HorizontalAlignment="Left" Margin="11,9,0,0" VerticalAlignment="Top" Width="61" Height="26"/>
        <TextBox x:Name="txtProjectName" HorizontalAlignment="Left" Height="23" Margin="77,11,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" IsEnabled="False" Width="392" IsReadOnly="True" Grid.ColumnSpan="3"/>
        <Button x:Name="toRight" Content="---&gt;" Grid.Column="2" HorizontalAlignment="Left" Margin="162,35,0,0" Grid.Row="2" VerticalAlignment="Top" Width="74" Click="toRight_Click"/>
        <Button x:Name="toLeft" Content="&lt;---" Grid.Column="2" HorizontalAlignment="Left" Margin="162,5,0,0" Grid.Row="3" VerticalAlignment="Top" Width="74" Click="toLeft_Click"/>
        <ListBox x:Name="lsSelectedTerminalNos" Grid.Row="1" Grid.Column="2" Grid.RowSpan="3" Margin="258,25,224,323" SelectionMode="Multiple"/>
        <TextBox x:Name="txtDeviceName" Grid.Column="2" HorizontalAlignment="Left" Height="23" Margin="409,0,0,0" Grid.Row="2" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="174"/>
        <TextBox x:Name="txtDeviceType" Grid.Column="2" HorizontalAlignment="Left" Height="23" Margin="409,52,0,0" Grid.Row="2" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="174" Grid.RowSpan="2"/>
        <Button Name="btnSaveDevice" Content="保存" Grid.Column="2" HorizontalAlignment="Left" Margin="409,29,0,0" Grid.Row="3" VerticalAlignment="Top" Width="174" Height="32" Click="btnSaveDevice_Click"/>
        <Label Content="装置名称" Grid.Column="2" HorizontalAlignment="Left" Margin="409,26,0,0" Grid.Row="1" VerticalAlignment="Top" Width="174"/>
        <Label Content="装置型号" Grid.Column="2" HorizontalAlignment="Left" Margin="409,30,0,0" Grid.Row="2" VerticalAlignment="Top" Width="174"/>
        <DataGrid Name="dgDevice" Grid.Column="2" HorizontalAlignment="Left" Margin="10,93,0,0" Grid.Row="3" VerticalAlignment="Top" Height="289" Width="573"  AutoGenerateColumns="False" IsReadOnly="True" SelectionChanged="dgDevice_SelectionChanged">
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding DeviceName}" Header="装置名称" Width="180"/>
                <DataGridTextColumn Binding="{Binding DeviceType}" Header="装置型号" Width="120"/>
                <DataGridTextColumn Binding="{Binding LoopLineIds,Converter={StaticResource tnColorCvrt}}" Header="端子号" Width="220"/>
            </DataGrid.Columns>
        </DataGrid>
        <ListBox x:Name="lbUnit" HorizontalAlignment="Left" Height="129" Margin="10,36,0,0" VerticalAlignment="Top" Width="268" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" SelectionChanged="lbUnit_SelectionChanged"/>
    </Grid>
</Window>
